﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrdersReport.ascx.cs"
    Inherits="ERP.UserControl.OrdersReport" %>
<form method="get" action="?">
<asp:Label runat="server" ID="LabelSimpleFilter" CssClass="failureNotification" Visible="false">סינון לפי סטטוס הזמנה</asp:Label>
<table class="simple-table" style="background-color: #6c849a; color: White; width: 100%;"
    dir="rtl">
    <tr>
        <th colspan="3">
            סינון
        </th>
    </tr>
    <tr class="advance-filter">
        <td>
            <asp:Label CssClass="filter-title" ID="lblPrice" runat="server">מחיר: </asp:Label>
            <br />
            <asp:RadioButton ID="rdoPriceAny" runat="server" GroupName="GroupPrice" Checked="true"
                Text="הכל" />
            <br />
            <asp:RadioButton ID="rdoPriceExacly" runat="server" GroupName="GroupPrice" Text="בדיוק - " />
            <asp:TextBox ID="txtExactPrice" runat="server"></asp:TextBox>
            <br />
            <asp:RadioButton ID="rdoPriceRange" runat="server" GroupName="GroupPrice" />
            <asp:Label ID="lblPriceRangeMin" runat="server" AssociatedControlID="txtPriceRangeMin">בין - </asp:Label><asp:TextBox
                ID="txtPriceRangeMin" runat="server"></asp:TextBox>
            <asp:Label ID="lblPriceRangeMax" runat="server" AssociatedControlID="txtPriceRangeMax">ל - </asp:Label><asp:TextBox
                ID="txtPriceRangeMax" runat="server"></asp:TextBox>
        </td>
        <td>
            <asp:Label CssClass="filter-title" ID="lblDate" runat="server">תאריך הזמנה (DD/MM/YYYY): </asp:Label>
            <br />
            <asp:RadioButton ID="rdoDateAny" runat="server" GroupName="GroupDate" Checked="true"
                Text="הכל" />
            <br />
            <asp:RadioButton ID="rdoDateExact" runat="server" GroupName="GroupDate" Text="בדיוק - " />
            <asp:TextBox ID="txtExactDate" runat="server"></asp:TextBox>
            <br />
            <asp:RadioButton ID="rdoDateRange" runat="server" GroupName="GroupDate" />
            <asp:Label ID="lblDateRangeMin" runat="server" AssociatedControlID="txtDateRangeMin">בין - </asp:Label><asp:TextBox
                ID="txtDateRangeMin" runat="server"></asp:TextBox>
            <asp:Label ID="lblDateRangeMax" runat="server" AssociatedControlID="txtDateRangeMax">ל - </asp:Label><asp:TextBox
                ID="txtDateRangeMax" runat="server"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td colspan="3" style="text-align: center;">
            <asp:DropDownList ID="cmbStatus" AppendDataBoundItems="true" runat="server">
            </asp:DropDownList>
            <asp:Button ID="btnFilter" runat="server" OnClick="btnFilter_onClick" Text="סנן" />
            <button type="button" onclick="$('.advance-filter').toggle()">
                סינון מתקדם
            </button>
            <br />
            <asp:Label runat="server" ID="lblMessage" CssClass="failureNotification" Visible="false"></asp:Label>
        </td>
    </tr>
</table>
<br />
<br />
<asp:Repeater runat="server" ID="RepOrders" OnItemDataBound="RepOrders_OnItemDataBound">
    <HeaderTemplate>
        <table class="simple-table">
            <tr>
                <th>
                    <asp:Localize ID="LocOrderId" runat="server" Text="<%$ Resources:Globals, OrderId%>"></asp:Localize>
                </th>
                <th>
                    סטטוס
                </th>
                <th>
                    מהות הרכישה
                </th>
                <th>
                    מחיר
                </th>
                <th>
                    ספק
                </th>
                <th>
                    תאריך הזמנה
                </th>
                <th>
                    יוצר ההזמנה
                </th>
            </tr>
    </HeaderTemplate>
    <ItemTemplate>
        <tr>
            <td>
                <asp:Label ID="OrderIdWithLinkContainer" runat="server" Visible="false"><a href="OrderForm.aspx?OrderId=<%#Eval("OrderId") %>">
                    <%#Eval("OrderId") %>
                </a></asp:Label>
                <asp:Label ID="OrderIdContainer" runat="server" Visible="false">
                    <%#Eval("OrderId") %>
                </asp:Label>
                <asp:HyperLink ID="printLink" runat="server" NavigateUrl='<%# Eval("OrderId", "~/ToPrintOrder.aspx?OrderId={0}") %>' Visible="False">הדפס הזמנה</asp:HyperLink>
            </td>
            <td>
                <span id="btnStatusUpdate" runat="server" visible="false"><a href="#" onclick="window.open('OrderStatusForm.aspx?OrderId=<%#Eval("OrderId")%>','Order Status Form','width=330,height=250');return false;">
                    <%# GetGlobalResourceObject("Globals", "OrderStatus_" + Eval("OrderStatus")) %></a>
                </span>
                <asp:Label ID="lblStatusOnly" runat="server" Visible="false"><%# GetGlobalResourceObject("Globals", "OrderStatus_" + Eval("OrderStatus")) %></asp:Label>
            </td>
            <td>
                <%#Eval("OrderReason") %>
            </td>
            <td>
                <%#Eval("Price","{0:0.00}") %>
            </td>
            <td>
                <%#Eval("ERP_Suppliers.Name")%>
            </td>
            <td>
                <%#Eval("CreationDate") %>
            </td>
            <td>
                <%#Eval("ERP_Users.FirstName") %>
                <%#Eval("ERP_Users.LastName")%>
            </td>
        </tr>
    </ItemTemplate>
    <FooterTemplate>
        </table></FooterTemplate>
</asp:Repeater>
<a href="../Handlers/OrdersExport.csv">ייצא הזמנות</a>
<br />
<br />
</form>
